﻿<Window x:Class="Library.Windows.Genres"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Library.Windows"
        xmlns:classes="clr-namespace:Library.Classes"
        mc:Ignorable="d"
        Title="Жанры" Height="400" Width="800"
        WindowStartupLocation="CenterScreen"
        WindowStyle="ToolWindow"
        MinHeight="400" MinWidth="800"
        MaxHeight="400" MaxWidth="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <GroupBox Header="Добавление нового жанра"
                  x:Name="GroupHeader"
                  Margin="5">
            <StackPanel>
                <Label Content="Жанр"/>
                <TextBox x:Name="genre"/>

                <Button Content="Добавить жанр"
                        Width="150" HorizontalAlignment="Right"
                        Margin="10 10"
                        x:Name="addGenre"
                        Click="addGenre_Click"/>
            </StackPanel>
        </GroupBox>
        <GroupBox Header="Список жанров"
                    Margin="5"
                  Grid.Column="1">
            <ListBox x:Name="listGenres"
             SelectionChanged="listGenres_SelectionChanged">
                <ListBox.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Изменить"
                          x:Name="ChangeRow"
                          Click="ChangeRow_Click"/>
                    </ContextMenu>
                </ListBox.ContextMenu>
            </ListBox>

        </GroupBox>
        
        <TextBlock Text="{Binding StringFormat=Количество строк {0}, 
    ElementName=listGenres, Path=Items.Count}"
                   Grid.Row="1" Grid.Column="1"
                   VerticalAlignment="Top"/>
    </Grid>
</Window>
